cal = list(map(int, input().split()))
strn = input()
sum_list = []
for i in strn:
if(i == "1"):
sum_list.append(cal[0])
elif(i == "2"):
sum_list.append(cal[1])
elif(i == "3"):
sum_list.append(cal[2])
elif(i == "4"):
sum_list.append(cal[3])
print(sum(sum_list))
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define For(i, s, e) for (ll i = s; i < e; i++)
#define FoR(i, s, e) for (ll i = s; i <= e; i++)
#define deFoR(i, s, e) for (ll i = s; i >= e; i--)
#define pb push_back
#define vii vector<ll>
#define makep make_pair
#define vpll vector<pair<ll, ll>>
#define fi first
#define se second
#define sii set<ll>
#define pii pair<int, int>
#define rev(c) reverse(c.begin(), c.end())
#define sortf(c) sort(c.begin(), c.end())
#define test() \
int test; \
cin >> test; \
while (test--)
#define fast() \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define sqr(n) (n)*(n)
#define len(s) (s.length())
ll const max2d = 1e4 + 7;
ll const N = 1e6 + 7;
ll const inf = 1e9 + 7;
char const nl = '\n';
// ! ¸,ø¤º°`°º¤ø,¸¸,ø¤º° [ нvмegy ] °º¤ø,¸¸,ø¤º°`°º¤ø,¸ roadтoнυe
void solve() {
}
signed main()
{
fast();
int a[5];
FoR(i, 1, 4) {
cin >> a[i];
}
string s;
cin >> s;
int sum = 0;
FoR(i, 0, len(s)-1) {
sum += a[s[i]-48];
}
cout << sum;
return 0;
}
1B - Spreadsheet | 1177A - Digits Sequence (Easy Edition) |
1579A - Casimir's String Solitaire | 287B - Pipeline |
510A - Fox And Snake | 1520B - Ordinary Numbers |
1624A - Plus One on the Subset | 350A - TL |
1487A - Arena | 1520D - Same Differences |
376A - Lever | 1305A - Kuroni and the Gifts |
1609A - Divide and Multiply | 149B - Martian Clock |
205A - Little Elephant and Rozdil | 1609B - William the Vigilant |
978B - File Name | 1426B - Symmetric Matrix |
732B - Cormen --- The Best Friend Of a Man | 1369A - FashionabLee |
1474B - Different Divisors | 1632B - Roof Construction |
388A - Fox and Box Accumulation | 451A - Game With Sticks |
768A - Oath of the Night's Watch | 156C - Cipher |
545D - Queue | 459B - Pashmak and Flowers |
1538A - Stone Game | 1454C - Sequence Transformation |